import random
import matplotlib.pyplot as plt
from playStats.descriptive_stats import mean
import time

def sample(num_of_samples,sample_sz):
    """num_of_samples 样本数
       sample_sz      样本容量
    """
    #样本均值
    data = []
    for _ in range(num_of_samples):
        data.append(mean([random.uniform(0.0,1.0) for _ in range(sample_sz)]))
    return data

if __name__ == "__main__":
    data = sample(10000,400)
    plt.hist(data,bins="auto",rwidth=0.8)
    plt.axvline(x=mean(data),c='red')
    plt.show()